<%--
  Created by IntelliJ IDEA.
  User: kkk
  Date: 2022/11/7
  Time: 18:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/statics/layui/css/layui.css"/>
    <script src="${pageContext.request.contextPath}/statics/layui/layui.js"  charset="utf-8"></script>
</head>
<body>
<div style="color: #ff0000">${erroeMsg}</div>
<form class="layui-form" action="add" method="post" enctype="multipart/form-data">
    <div class="layui-form-item">
        <label class="layui-form-label">账号</label>
        <div class="layui-input-block">
            <input type="text" id="account" name="account" lay-verify="title" autocomplete="off" placeholder="请输入账号" class="layui-input">
            <span>${accountError}</span>
            <span id="accountSpan">${accountError}</span>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">真实姓名</label>
        <div class="layui-input-block">
            <input type="text" name="realName" lay-verify="title" autocomplete="off" placeholder="请输入真实姓名" class="layui-input">
            <span>${realNameError}</span>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-block">
            <input type="text" name="password" lay-verify="title" autocomplete="off" placeholder="请输入密码" class="layui-input">
            <span>${passwordError}</span>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">性别</label>
        <div class="layui-input-block">
            <input type="radio" name="sex" value="1" title="女">
            <input type="radio" name="sex" value="2" title="男" checked>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">出生日期</label>
        <div class="layui-input-block">
            <input type="date" name="birthday" lay-verify="title" autocomplete="off" placeholder="请输入出生日期" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">电话</label>
        <div class="layui-input-block">
            <input type="text" name="phone" lay-verify="title" autocomplete="off" placeholder="请输入电话" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">地址</label>
        <div class="layui-input-block">
            <input type="text" name="address" lay-verify="title" autocomplete="off" placeholder="请输入地址" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">角色</label>
        <div class="layui-input-block">
            <select name="roleId" lay-filter="aihao">=
                <option value="1" selected="">管理系统员</option>
                <option value="2">店长</option>
                <option value="3">店员</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">证件照</label>
        <div class="layui-input-block">
            <input type="file" name="idpic" lay-verify="title" autocomplete="off"  class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<%--<script src="${pageContext.request.contextPath}/statics/layui/layui.js"></script>--%>

<script>
    layui.use(['form','jquery'], function(){
        var form = layui.form;
        var $= layui.jquery;

        $("#account").blur(function () {
            $.get("accountExists?account="+this.value,function (data) {
                alert(data)
                if (data=="1"){
                    $('#accountSpan').html("该账号已存在");
                    $('#account').html("");
                }else {
                    $('#accountSpan').html("");

                }
            })
        })
    });
</script>
</body>
</html>
